<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *商品管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return['status']=$this->bill_status;
if($_RQ['op']=='list'){
	$params=array('merchid'=>$_SESSION['onemerchid']);
	$params['uniacid']=$_SESSION['uniacid'];
	if(!empty($_RQ['billid'])){
		$params['billid']=trim($_RQ['billid']);
		$return['params']['billid']=$_RQ['billid'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_globonus_billp',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['uid']);
			$bill=pdo_get('jy_globonus_bill',array('id'=>$item['billid']));
			$item['billno']=$bill['billno'];
			$item['date']=$bill['year'].'-'.$bill['month'];
			if($bill['week']){
				$item['date'] .='第'.$bill['week'].'周';
			}
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'明细'),
		),
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>true,'delall'=>true,'list'=>array(
			array('name'=>'member','title'=>'会员信息','type'=>'member'),
			array('name'=>'billno','title'=>'结算单号','type'=>'string'),
			array('name'=>'date','title'=>'日期','type'=>'string'),
			array('name'=>'money','title'=>'分红金额','type'=>'string'),
			array('name'=>'paymoney','title'=>'到账金额','type'=>'string'),
			array('name'=>'charge','title'=>'手续费比例','type'=>'unitstring','unit'=>'%'),
			array('name'=>'chargemoney','title'=>'手续费','type'=>'string'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status'),
			array('name'=>'createtime','title'=>'时间','type'=>'time'),
		)),
		'search_one'=>array('name'=>'billid','title'=>'结算单ID','add'=>false),
	);
	$return['htmls']=$htmls;
	$return['status']=$this->billp_status;
	exi($return);
}
